<template>
	<view>
		<view class="top">
			<view :class="{active:i==0}" @tap="an(0)">
				待付款
			</view>
			<view :class="{active:i==1}" @tap="an(1)">
				已付款
			</view>
			<view :class="{active:i==2}" @tap="an(2)">
				已发货
			</view>
			<view :class="{active:i==3}" @tap="an(3)">
				已收货
			</view>
			<view :class="{active:i==4}" @tap="an(4)">
				申请退款
			</view>
		</view>
		
		
		<view class="kuai">
			
		</view>
		
		
		
		
		
		
	</view>
</template>

<script>
	import{order}from "../../../util/user/dingdan.js"
	export default {
		data() {
			return {
				i:0,
				list:[]
			};
		},
		
		methods:{
			an(i){
				this.i = i
				
				var obj0=[]
				var obj1=[]
				var obj2=[]
				var obj3=[]
				var obj4=[]
				var that = this.list
				that.forEach(res =>{
					if(res.status ==0){
						obj0.push(res)
						that = obj0
					}if(res.status ==1){
						obj1.push(res)
						that = obj1
					}if(res.status ==2){
						obj2.push(res)
						that = obj2
					}if(res.status ==3){
						obj3.push(res)
						that = obj3
					}if(res.status ==4){
						obj4.push(res)
						that = obj4
					}
				})
			
				// console.log(that)
				// console.log(obj0)
				// console.log(obj1)
			}
		},
		onLoad() {
			
	
			
			
			
			
		var val=uni.getStorageSync("data")
			console.log(val)
			order({
				userId:val.id
			})
			.then(res =>{
				this.list = res.data.data.list
				console.log(res)
			})
			
			
			
			
			uni.setNavigationBarTitle({
				title: '订单',
			
			});
			uni.setNavigationBarColor({
			
				frontColor: '#ffffff',
				backgroundColor: ' #354E44',
				animation: {
					duration: 400,
					timingFunc: 'easeIn'
				}
			})
			
			
		}
	}
</script>

<style lang="scss" scoped>

.top{
	width: 100%;
	color: #FFFFFF;
	height: 50rpx;
	background-color: green;
	display: flex;
	justify-content: space-around;
}
.active{
	color: red;
}


.kuai{
	width: 80%;
	height: 350rpx;
	background-color: yellow;
	border-radius: 20rpx;
	margin: 0 auto;
	margin-top: 50rpx;
	
}
</style>
